
const {sequelize,Sequelize} = require('../../database/init')

//考试模型
const Examination = sequelize.define('Examination',{

    exam_name:{
        type: Sequelize.STRING,
        allowNull: false,
        commit:"考试的名称"
    },
    exam_description:{
        type: Sequelize.STRING,
        allowNull:true,
        commit:"考试的介绍"
    },
    exam_open_time:{
        type:Sequelize.DATE,
        allowNull: false,
        commit:"考试开放时间"
    },
    exam_close_time:{
        type:Sequelize.DATE,
        allowNull: false,
        commit:"考试关闭时间"
    },
    limit_time:{
        type:Sequelize.DATE,
        allowNull: true,
        commit:"考试限时"
    },

})
//考卷模型
const ExamPaper = sequelize.define('ExaminationPaper',{
    exam_paper_name:{
        type: Sequelize.STRING,
        allowNull: false,
        commit:"考卷的名称"
    },
    exam_paper_description:{
        type: Sequelize.STRING,
        allowNull:true,
        commit:"考卷的介绍"
    },
})
//考题模型
const ExamQuestion = sequelize.define('ExamQuestion',{
    title:{
        type: Sequelize.STRING,
        commit:"考题的问题"
    },
    type:{
        type:Sequelize.SMALLINT,
        allowNull:false,
        commit:"考题的类型"
    },
    eq_order:{
        type:Sequelize.SMALLINT,
        allowNull:false,
        defaultValue:0,
        commit:"考题顺序"
    },
    analysis:{
        type: Sequelize.STRING,
        commit:"考题的解析"
    },
    difficulty:{
        type: Sequelize.FLOAT,
        commit:"考题难度"
    },
    qt_body:{
        type:Sequelize.JSON,
        allowNull:false,
        commit:"考题的主体"
    }
})
//答卷模型
const AnswerPaper =sequelize.define('AnswerPaper',{
    id:{
        type:Sequelize.INTEGER,
        autoIncrement:true,
        primaryKey:true,
        unique:true
    },
    start_time:{
        type:Sequelize.DATE,
        allowNull:true,
    },
    end_time:{
        type:Sequelize.DATE,
        allowNull:true,
    }
})
//答题模型
const AnswerQuestion = sequelize.define('AnswerQuestion',{
    aq_body:{
        type:Sequelize.JSON,
        allowNull:false,
        commit:"答题的主体"
    }
})



module.exports = {
    Examination,
    ExamPaper,
    ExamQuestion,
    AnswerPaper,
    AnswerQuestion
}

